<!--
 * @Author: gonghairun
 * @Date: 2020-11-19 10:16:14
 * @LastEditors: gonghairun
 * @LastEditTime: 2021-05-05 10:36:42
 * @Description: //新增/编辑子票货
-->
<template>
    <div class="likeQuery" v-loading="loading"
        element-loading-text="拼命加载中"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(0, 0, 0, 0.8)">
        <!-- <div class="close" @click="closeHandleClick()"></div> -->
        <iframe v-if="iframeUrl!=''" id="MyFrame" name="MyFrame1" :src="iframeUrl" :style="{width:'100%',height:height+'px',border:'none'}" />
    </div>
</template>

<script>
export default {
    name: "likeQuery",
    props:{
        shipForm:{
            type:Object
        },
        close:{
            type:Function
        }
    },
    components: {
    },
    data() {
        return {
            iframeUrl:'',
            height:window.innerHeight-80,
            loading: false,
        };
    },
    created() {
    },
    computed:{
    },
    watch : {
        shipForm:{
            handler(val){
                const _this = this
                _this.loading = true
                _this.iframeUrl = ''
                setTimeout(()=>{
                    _this.iframeUrl = "../likeQuery/#/?token="+encodeURIComponent(window.sessionStorage.getItem('token'))+'&id='+val.id+'&shipid='+val.shipId+'&voyage='+val.voyage
                    // _this.iframeUrl = "http://192.168.75.140:9190/likeQuery/#/?token="+encodeURIComponent(window.sessionStorage.getItem('token'))+'&id='+val.id+'&shipid='+val.shipId+'&voyage='+val.voyage
                    _this.$nextTick(()=>{
                        var iframe = document.getElementById("MyFrame");    
                        if (iframe.attachEvent){
                            iframe.attachEvent("onload", function(){
                                _this.loading = false
                            });
                        } else {
                            iframe.onload = function(){
                                _this.loading = false
                            };
                        }
                    })
                },1000)
            },
            immediate:true
        }
    },
    mounted() {
    },
    methods: {
        /**
         * @Author: gonghairun
         * @description: 关闭
         * @param {*}
         * @return {*}
         */
        closeHandleClick() {
            this.close()
        }
    }
};
</script>

<style lang="less" scoped>
.likeQuery{
    width: 100%;
    height: 100%;
    position: relative;
    // background-image: url('../../../assets/img/queryBg.png');
    // background-repeat: no-repeat;
    // background-size: 100% 100%;
    /deep/.el-icon-loading{
        font-size: 40px;
    }
    /deep/.el-loading-text{
        font-size: 18px;
    }
    .loadingBg{
        position: absolute;
        top:0;
        left:0;
        width: 100%;
        height:100%;
        z-index:100;
    }
    .close{
        width: 40px;
        height: 40px;
        position: absolute;
        top:0;
        right:0;
        cursor: pointer;
    }
}
</style>
